package com.greate.community.controller;

import com.greate.community.service.UserInfoService;
import com.greate.community.util.BusCodeEnum;
import com.greate.community.util.CommunityConstant;
import com.greate.community.util.CommunityUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

@Controller
@RequestMapping("/userInfo")
public class UserInfoController implements CommunityConstant {

    @Autowired
    private UserInfoService userInfoService;


    /**
     * 修改信息
     * @param id
     * @param gender
     * @param phone
     * @param department
     * @param specialities
     * @param signature
     * @return
     */
    @PostMapping("/updateInfo")
    @ResponseBody
    public String updateInfo(Long id, String gender, String phone, String department,
                             Integer grade, String specialities, String signature){
        userInfoService.updateInfo(id, gender, phone, department, grade, specialities, signature);
        return CommunityUtil.getJSONString(BusCodeEnum.SUCCESS.getCode(), BusCodeEnum.SUCCESS.getMsg());
    }
}
